package com.ad.pet.app.mall.view;

import android.app.Dialog;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;

import com.ad.pet.R;

/**
 * Created by liuyixiang on 2019/11/18.
 */

public class ServiceSkuDialog extends Dialog {
    private int screenWidth;
    public ServiceSkuDialog(@NonNull Context context) {
        super(context);
    }

    public ServiceSkuDialog(Context context, int themeResId) {
        super(context, themeResId);
        screenWidth = context.getResources().getDisplayMetrics().widthPixels;
       View mView = View.inflate(context,R.layout.layout_service_sku,null);
       setContentView(mView);
    }

    @Override
    public void show() {
        super.show();
        Window window = this.getWindow();
        WindowManager.LayoutParams lp = window.getAttributes();
        lp.height=ViewGroup.LayoutParams.WRAP_CONTENT;
        lp.width= ViewGroup.LayoutParams.MATCH_PARENT;
//        lp.height  = LyxUtils.dp2px(getContext(),430);
//        lp.width = (screenWidth *  8/ 10); // 设置宽度
        this.getWindow().setAttributes(lp);
        window.setGravity(Gravity.BOTTOM);
    }
}

